/*
 * RepositoryQueryElement.java
 *
 * Created on September 8, 2007, 9:20 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.adl.registry.website.lucene;

import org.adl.registry.types.Repository;

/**
 *
 * @author Jacob
 */
public class RepositoryQueryElement implements QueryElement
{
    private String mElementValue;
    
    /** Creates a new instance of MetadataIdentifierQueryElement */
    public RepositoryQueryElement()
    {
    }
    
    /** Creates a new instance of MetadataIdentifierQueryElement */
    public RepositoryQueryElement(String elementValue)
    {
        this.setElementValue(elementValue);
    }
    
    public String getElementValue()
    {
        return this.mElementValue;
    }
    
    public void setElementValue(String elementValue)
    {
        if ((elementValue == null) || (elementValue.length() == 0))
        {
            //TODO: throw exception
        }
        
        this.mElementValue = elementValue;
    }
    
    public String toString()
    {
        if ((this.mElementValue == null) || (this.mElementValue.length() == 0))
        {
            return "";
        }
        else
        {
            String value = "repositoryIdentifier:";
            
            if (this.mElementValue.contains("/") == false)
            {
                value += Repository.REPOSITORY_NAMESPACE + "/";
            }
            
            //value += this.mElementValue + "*";
            
            return value;
        }
    }
}
